home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5919 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: Inter.NL.net!usenet
  2. From: Auke.Reitsma@net.HCC.nl (Auke Reitsma)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Initialising structure members - help please!
  5. Date: Tue, 20 Feb 1996 20:23:51 GMT
  6. Organization: Inter.NL.net, The Internet Provider in The Netherlands.
  7. Message-ID: <4gdasm$bhv@altrade.nijmegen.inter.nl.net>
  8. References: <4gb8hn$3m8@news.mistral.co.uk>
  9. Reply-To: Auke.Reitsma@net.HCC.nl
  10. NNTP-Posting-Host: rt99-20.rotterdam.nl.net
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. mikebarnard@mistral.co.uk (Mike Barnard) wrote:
  14.  
  15. ...
  16. > struct    menuitem
  17. >     {
  18. >     int number;            // Item 1, item 2 etc.
  19. >     char description[70];        // Room for a text description
  20. >     struct menuitem *next;        // Pointer to next menu item
  21. >     struct menuitem *last;        // Pointer to last menu item
  22. >     };
  23.  
  24. Answer this:  "What is the type of the element named 'next"?
  25.  
  26. > Now I create 5 instances of variables of the type menuitem...
  27. ...
  28. > struct menuitem one,two,three,four,five;
  29.  
  30. again: "What is the type of each of these"?
  31.  
  32. > Now, the fun (not) bit. I tried to initialise the items with...
  33.  
  34. > one.number = 1;
  35. > one.description = "1.   Calculate a minefield";
  36. > one.next = two;
  37.  
  38. So what type are you assigning to the other?
  39.  
  40. > one.last = five;
  41. ...
  42. > This is an almost exact copy of the structure examples in my book.
  43. > (The beginners guide to C by Wrox). Page 387 for those who have it.
  44.  
  45. Probably ;-) Hint: you may be missing a single character ...
  46.  
  47. > So, can anyone help please? (I must get snippets!).
  48.  
  49. Yes, you should get Snippets ;-)
  50.  
  51.  
  52. Greetings from Delft, The Netherlands.
  53.  
  54. Auke Reitsma
  55.  
  56.